import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';

export const querySchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    fieldName: 'jobName',
    label: '任务名称',
  },
  {
    component: 'Input',
    fieldName: 'jobGroup',
    label: '任务组名',
  },
  {
    component: 'Textarea',
    fieldName: 'invokeTarget',
    label: '调用目标字符串',
  },
  {
    component: 'Textarea',
    fieldName: 'jobMessage',
    label: '日志信息',
  },
  {
    component: 'RadioGroup',
    componentProps: {
      buttonStyle: 'solid',
      optionType: 'button',
    },
    fieldName: 'status',
    label: '执行状态',
  },
  {
    component: 'Textarea',
    fieldName: 'exceptionInfo',
    label: '异常信息',
  },
];

// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
  { type: 'checkbox', width: 60 },
  {
    title: '任务日志ID',
    field: 'jobLogId',
  },
  {
    title: '任务名称',
    field: 'jobName',
  },
  {
    title: '任务组名',
    field: 'jobGroup',
  },
  {
    title: '调用目标字符串',
    field: 'invokeTarget',
  },
  {
    title: '日志信息',
    field: 'jobMessage',
  },
  {
    title: '执行状态',
    field: 'status',
  },
  {
    title: '异常信息',
    field: 'exceptionInfo',
  },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 180,
  },
];
